package com.powernode.factory;

import com.powernode.strategy.LoginStrategy;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 * 工厂模式 生产登录策略工厂
 * @Author: DongGuoZhen
 * @Date: 2025/09/11/22:13
 * @Description:
 */
//登录策略工厂类
@Component
public class LoginStrategyFactory {

    @Autowired
    private Map<String,LoginStrategy> loginStrategyMap = new HashMap<>();



    /**
     * 根据用户登录类型来获取具体的策略
     * @param loginType
     * @return
     */
    public LoginStrategy getLoginStrategy(String loginType) {
        return loginStrategyMap.get(loginType);
    }
}
